package com.yuhs.zixing.study.design.pattern.dp002.create.c001.singleton;

/**
 * @description 懒汉式 同步代码块
 * @author: yuhs
 * @date 2022/3/30 下午3:54
 */
public class SingletonDemo005 {

    private SingletonDemo005() {
    }

    private static SingletonDemo005 instance;

    public static SingletonDemo005 getInstance() {
        synchronized (SingletonDemo005.class) {
            if (instance == null) {
                instance = new SingletonDemo005();
            }
        }
        return instance;
    }
}
